@extends('layouts.application')

@section('content')

    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">

            <h2 class="am-text-primary title_order">购买订单</h2>
            <hr>

            <form class="am-form-inline am-u-sm-offset-0"
                  role="form"
                  method="get">

                <div class="am-form-group search-set">
                    <input type="text" class="am-form-field am-input-sm" name="order_no" placeholder="订单号" value="{{ Request::input('order_no') }}">
                </div>

                <div class="am-form-group search-set">
                    <input type="text" class="am-form-field am-input-sm" name="buy_name" placeholder="买家" value="{{ Request::input('buy_name') }}">
                </div>

                <div class="am-form-group search-set">
                    <input type="text" class="am-form-field am-input-sm" name="seller_name" placeholder="卖家" value="{{ Request::input('seller_name') }}">
                </div>

                <div class="am-form-group search-set">
                    <input type="text" class="am-form-field am-input-sm" name="game_account" placeholder="游戏账号" value="{{ Request::input('seller_name') }}">
                </div>

                <div class="am-form-group search-set">
                    <span>创建时间</span>
                    <input type="text" class="am-form-field am-input-sm" placeholder="开始时间" id="start_time" name="start_time" data-am-datepicker="{theme: 'success'}" value="{{ Request::input('start_time') }}" readonly/>
                    <span>至</span>
                    <input type="text" class="am-form-field am-input-sm" placeholder="结束时间" id="end_time" name="end_time" data-am-datepicker="{theme: 'success'}" value="{{ Request::input('end_time') }}" readonly/>
                </div>

                <div class="am-form-group search-set">
                    <select data-am-selected="{btnSize: 'sm', searchBox: 1, maxHeight:360}" name="big_game_id">

                        <option>全部游戏</option>
                        @foreach($games as $game)
                            <option value="{{$game->id}}" @if(Request::input('big_game_id')==$game->id) selected @endif>{{$game->game_name}}</option>
                        @endforeach
                    </select>
                </div>

                <div class="am-form-group search-set">
                    <select data-am-selected="{btnSize: 'sm', searchBox: 1, maxHeight: 360}"
                            name="order_status">
                        <option>订单状态</option>
                        <option value="0" @if(Request::input('order_status')=='0') selected @endif>未付款</option>
                        <option value="1" @if(Request::input('order_status')=='1') selected @endif>支付中</option>
                        <option value="2" @if(Request::input('order_status')=='2') selected @endif>支付成功</option>
                        <option value="3" @if(Request::input('order_status')=='3') selected @endif>支付失败</option>
                        <option value="4" @if(Request::input('order_status')=='4') selected @endif>维权中</option>
                        <option value="5" @if(Request::input('order_status')=='5') selected @endif>退款成功</option>
                        <option value="6" @if(Request::input('order_status')=='6') selected @endif>退款失败</option>
                        <option value="7" @if(Request::input('order_status')=='7') selected @endif>取消订单</option>
                        <option value="8" @if(Request::input('order_status')=='8') selected @endif>自产自销</option>
                        <option value="100" @if(Request::input('order_status')=='100') selected @endif>交易完成</option>
                    </select>
                </div>

                <div class="am-form-group search-set">
                    <select data-am-selected="{btnSize: 'sm', searchBox: 1}" name="statistical">
                        <option selected>是否统计</option>
                        <option value="1" @if(Request::input('is_count')==1) selected @endif >是</option>
                        <option value="0" @if(Request::input('is_count')==0) selected @endif >否</option>
                    </select>
                </div>

                <div class="am-form-group search-set">
                    <button type="submit"
                            class="am-btn am-btn-secondary am-btn-sm">查 询
                    </button>
                </div>

            </form>
            <hr>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover am-table-radius am-table-bordered table_order_font">
                            <thead>
                            <tr>
                                <th class="table-check"><input type="checkbox"/></th>
                                <th>创建时间</th>
                                <th>订单号</th>
                                <th>标题</th>
                                <th>游戏类型</th>
                                <th>交易方式</th>
                                <th>买家</th>
                                <th>卖家</th>
                                <th>订单状态</th>
                                <th>价格</th>
                                <th>查看详情</th>
                            </tr>
                            </thead>
                            <tbody>

                            @foreach($buys as $value)
                                <tr class="{!! set_order_class($value->order_status) !!}">
                                    <td><input type="checkbox"/></td>
                                    <td>{!! set_time($value->create_time) !!}</td>
                                    <td>{{$value->order_no}}</td>
                                    <td>{{$value->goods_title}}</td>
                                    <td class="am-hide-sm-only">{{$value->game_all_name}}</td>
                                    <td class="am-hide-sm-only">出售</td>
                                    <td>{{$value->buyer_name}}</td>
                                    <td>{{$value->seller_name}}</td>
                                    <td>{!! set_order_status($value->order_status) !!}</td>
                                    <td class="price">￥{{$value->sale_price}}</td>
                                    <td><a href="{{route('order.item',$value->id)}}">查看详情</a></td>
                                </tr>
                            @endforeach

                            </tbody>
                        </table>
                        <div class="am-cf">
                            共 15 条记录
                            <div class="am-fr">
                                <ul class="am-pagination">
                                    {{--                                    {{$buys->links()}}--}}
                                </ul>
                            </div>
                        </div>


                        <hr/>
                        <p>注：.....</p>
                    </form>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>
    <!-- content end -->
@endsection


